package com.lucenly.card.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lucenly.card.R;
import com.lucenly.card.bean.WithdrawBean;
import com.lucenly.card.utils.TimeUtils;

public class WithdrawAdapter extends BaseQuickAdapter<WithdrawBean,BaseViewHolder> {
    public WithdrawAdapter() {
        super(R.layout.item_withdraw);
    }

    @Override
    protected void convert(BaseViewHolder helper, WithdrawBean item) {
        ImageView iv_img = helper.getView(R.id.iv_img);
        TextView tv_money = helper.getView(R.id.tv_money);
        TextView tv_status = helper.getView(R.id.tv_status);
        TextView tv_start = helper.getView(R.id.tv_start);
        TextView tv_end = helper.getView(R.id.tv_end);
        if(item.way==1){
            iv_img.setImageResource(R.mipmap.wx_tb2x);
        }else{
            iv_img.setImageResource(R.mipmap.zfb_tb2x);
        }
        tv_money.setText("¥ "+item.withdrawFee);
        if(item.status==1){
            tv_status.setText("申请中");
        }else if(item.status==2){
            tv_status.setText("已完成");
        }else {
            tv_status.setText("已退回");
        }
        tv_start.setText("申请时间: "+TimeUtils.stampToDate(item.createTime*1000+"","yyyy-MM-dd HH:mm:ss"));
        if(item.status==1){
            tv_end.setVisibility(View.GONE);
        }else if(item.status==2){
            tv_end.setVisibility(View.VISIBLE);
            tv_end.setText("打款时间: "+TimeUtils.stampToDate(item.payTime*1000+"","yyyy-MM-dd HH:mm:ss"));
        }else{
            tv_end.setVisibility(View.VISIBLE);
            tv_end.setText("退回时间: "+TimeUtils.stampToDate(item.payTime*1000+"","yyyy-MM-dd HH:mm:ss"));
        }
    }
}
